<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
        window.onload = function(){
            setTimeout(function(){
                //晚于在加载中定义的setTimeout执行
                console.log(4);
            },0);
            console.log(2);
        };
        setTimeout(function(){
            //晚于onload执行
            console.log(3);
        },0);
        console.log(1);
    </script>
</body>
</html>